package com.example.malltest0.service.impl;

import com.example.malltest0.Vo.FollowersVo;
import com.example.malltest0.dao.FollowersDao;
import com.example.malltest0.mbg.mapper.FollowersMapper;
import com.example.malltest0.mbg.model.Followers;
import com.example.malltest0.mbg.model.FollowersExample;
import com.example.malltest0.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FollowServiceImpl implements FollowService {

    @Autowired
    private FollowersMapper followersMapper;

    @Autowired
    private FollowersDao followersDao;
    @Override
    public void addFollow(Followers followers) {
         followersMapper.insert(followers);
    }

    @Override
    public int updateFollow(Followers followers) {
//        Followers followers1=followersMapper.selectByPrimaryKey(followers.getId());
//        FollowersExample followersExample=new FollowersExample();
//        FollowersExample.Criteria criteria=followersExample.createCriteria();
//        criteria.andIdEqualTo(followers.getId());
//        Followers followers2=new Followers();
//
//        followers2.setName(followers.getName());
//
//        categoryMapper.updateByExampleSelective(category,example)
//        followersMapper.updateByExample()

        return 0;
    }

    @Override
    public FollowersVo selectById(Long id) {
       return followersDao.selectByPrimaryKey(id);

    }

    @Override
    public List<FollowersVo> selectAll() {

        return followersDao.selectAll();
    }

    @Override
    public List<FollowersVo> selectByUid(Long uid) {

        return followersDao.selectByUid(uid);
    }
}
